<?php
//dezend by http://www.yunlu99.com/ QQ:270656184
defined('BASEPATH') || exit('No direct script access allowed');
$this->load->helper('url');
?><link rel="stylesheet" type="text/css" href="/static/css/upload.css">
<form id="ff" method="post" style="margin:10px 0px 0px 10px;display:block;">
	<input type="hidden" name="id" value="<?php echo $id;?>">
	<table style="font-size:12px;" cellspacing="5">
		<tr>
			<td>角色名称</td>
			<td><input type="text" class="easyui-validatebox" name="name" value="<?php echo $name;?>" required="true"></td>
		</tr>
		<tr>
			<td>功能列表</td>
			<td>
				
<?php
foreach ($admin_ower as $k => $v) {
?>				<div style="font-weight:bold;padding:10px 0px 7px 0px;"><input type="checkbox" name="actions[]" value="<?php echo $k;?>" 
<?php
	if (in_array($k, explode(',', $actions))) {
?>checked<?php
	}

?>><?php echo $v['name'];?></div>
				<div style="padding:0px 20px;">
					
<?php
	foreach ($v['child'] as $k1 => $v1) {
?>					<label><input type="checkbox" name="actions[]" value="<?php echo $k1;?>" 
<?php
		if (in_array($k1, explode(',', $actions))) {
?>checked<?php
		}

?>><?php echo $v1['name'];?></label>
					<?php
	}

?>				</div>
				<?php
}

?>			</td>
		</tr>
		<tr>
			<td></td>
			<td>
			<button type="submit" class="easyui-linkbutton" iconCls="icon-ok">提交</button>
			</td>
		</tr>
	</table>
</form>

<script language="javascript">
$(function(){
	$('#ff').form({
		url:'<?php echo site_url('power/update');?>',
		onSubmit:function(){
			return $(this).form('validate');
		},
		success:function(data){
			data = eval('('+data+')');
			$.messager.alert('信息提示',data.msg,'info');
			if(data.error == 0){
				$('#win').window('close');
				$('#tt').datagrid('reload');
			}
		}
	});
	
});
</script>